import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
    {
        path: "/",
        redirect: "/login",
    },
    {
        path: "/login",
        component: () =>
            import(/* webpackChunkName: "about" */ "../views/Login.vue"),
    },
    {
        path: "/",
        component: () => import("../views/admin/Index.vue"),
        children: [
            {
                path: "dashboard",
                component: () => import("../views/admin/Dashboard.vue"),
            },
            {
                path: "role",
                component: () => import("../views/admin/Role.vue"),
            },
            {
                path: "user",
                component: () => import("../views/admin/User.vue"),
            },
        ],
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;
